package se.gu.sem;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;

public class LoadingScreen extends Activity {

//Introduce a delay
    private final int WAIT_TIME = 1500;
    @Override
    protected void onCreate(Bundle savedInstanceState) {

    GUApp univ = ((GUApp)getApplicationContext());
    
	super.onCreate(savedInstanceState);
	
    if(univ.getUniv().equals("GU"))
    	setContentView(R.layout.guloading_screen);
    else if(univ.getUniv().equals("CH"))
    	setContentView(R.layout.chloading_screen);
	
	
	
	findViewById(R.id.mainSpinner1).setVisibility(View.VISIBLE);

	new Handler().postDelayed(new Runnable(){ 
	@Override 
	    public void run() { 
		
		
		GUApp univ = ((GUApp)getApplicationContext());
		if(univ.getView().equals("main")){		
        
			Intent mainIntent = new Intent(LoadingScreen.this,GUActivity.class); 
		    LoadingScreen.this.startActivity(mainIntent); 
		    LoadingScreen.this.finish(); 
		}
		else if(univ.getView().equals("twitter")){
			
			Intent mainIntent = new Intent(LoadingScreen.this,AndroidTwitterActivity.class); 
		    LoadingScreen.this.startActivity(mainIntent); 
		    LoadingScreen.this.finish(); 
		}
		

	} 
	}, WAIT_TIME);
      }
}